package ar.edu.caece.compiler.grammars.sample2.factories;

import ar.edu.caece.compiler.grammars.sample2.tokens.TokenVisitorInterface;
import ar.edu.caece.compiler.model.LexicalAnalyzer;

public class FFactory extends AbstractTokenVisitorFactory{

	private static FFactory INSTANCE;
	private F1Factory f1Factory = F1Factory.getInstance();
	private F2Factory f2Factory = F2Factory.getInstance();
	private F3Factory f3Factory = F3Factory.getInstance();

	private Initializer initializer = new Initializer() {
	
		
		
		@Override
		public void init() {
			initializer = NoOperationInitializer.getInstance();
			
		}
		
	};
	
	public FFactory(LexicalAnalyzer analizadorLexico) {
		super(analizadorLexico);
		// TODO Auto-generated constructor stub
	}

	public FFactory() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public TokenVisitorInterface makeChainedVisitor(TokenVisitorInterface siguiente) {
		return f1Factory.makeChainedVisitor(f2Factory.makeChainedVisitor(f3Factory.makeChainedVisitor(siguiente)));
	}

	@Override
	public TokenVisitorInterface makeVisitor() {
		return f1Factory.makeChainedVisitor(f2Factory.makeChainedVisitor(f3Factory.makeVisitor()));
	}

	public static FFactory getInstance() {
		if(INSTANCE==null) INSTANCE = new FFactory();
		return INSTANCE;
	}

}
